function addText() {
	//Add text that player has wrote to chat input
	var plname=$('#pl1_name').html();
	var userInput = document.getElementById('userInput').value;
	op = document.createElement('div');
	op.innerHTML = plname+": "+userInput;
	ocontent = document.getElementById('chat_content');
	ocontent.appendChild(op);
	ocontent.scrollTop = ocontent.scrollHeight;
}

function addlog(k,words){
	//Adds any kind of log information, that is displayed as Dealer:
	var plname=$("#pl"+k+"_name").html();
	text = document.createElement('div');
	if (k==0){
		text.innerHTML = words;
	}
	else{
		text.innerHTML = "player "+plname+" "+words;
	}
	$('#chat_content').append(text).animate({ scrollTop: $('#chat_content').attr("scrollHeight") }, 0);
	//$('#chat_content').animate({scrollTop: $('#chat_content')[0].scrollHeight});
	//$('#chat_content').animate({ scrollTop: $('#chat_content').attr("scrollHeight") }, 3000);
}

function exitwindow(){
	//Function to exit the game(works only if it is open by javascript)
	var x=confirm("Are you sure you want to exit?");
	if (x==true){
		window.close();
	}
}

function restartgame(){
	//Refresh the window, that makes the game to restart
	var x=confirm("Are you sure you want to restart the game?");
	if (x==true){
		history.go();
	}
}

function addyourname(){
	//Function to replace the name of the player at start of the game
	var name = prompt("What is your name?", "Unnamed");
	$("#pl1_name").html(name);
}
function pausecomp(millis){
	//A delay for the script
	var date = new Date();
	var curDate = null;
	do { curDate = new Date(); }
	while(curDate-date < millis);
}